home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2003-07-17 | 86.6 KB | 3,231 lines
// Copyright (C) 1997-2002 Alias|Wavefront, // a division of Silicon Graphics Limited. // // The information in this file is provided for the exclusive use of the // licensees of Alias|Wavefront. Such users have the right to use, modify, // and incorporate this code into other products for purposes authorized // by the Alias|Wavefront license agreement, without fee. // // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. // // // Alias|Wavefront Script File // MODIFY THIS AT YOUR OWN RISK // // Creation Date: April, 1997 // Author: Carol Levy // // Description: // This script contains code to create the layouts for the // dynamics option boxes (for Dynamics menus). // // Input Arguments to dynCreateLayout(): // string $parent -- the layout parent // int $theCmd -- the command for which the layout is being created // int $isCreate -- create or add mode // // Return Value: // None. // global int $dynIsCreate; global string $__INST_OBJ_LIST_items[]; global proc PIcreateDynamicMenuItem( string $list[], string $attrName, string $default ) // // Description: // // This proc creates the dynamic menus for the particle instancer for each of the // instancer parameters (i.e. position, rotation, aim direction, etc). The format // of the command it creates is a follows: // // optionMenuGrp -l "Position" "PositionOM"; // menuItem -l "worldPosition" "PositionMenuItem1"; // menuItem -l "worldVelocity" "PositionMenuItem2"; // ... // { int $index = 1; string $miName; string $omName = $attrName + "OM"; optionMenuGrp -l $attrName -cc ("PIupdateDynamicAttributeOptionVar " + $attrName) $omName; // Make sure that all attributes have a "None" menu item except // for "Position" which always needs to have a valid value. // if ( $attrName != "Position" ) { $miName = $attrName + "MenuItem" + $index; menuItem -l "None" $miName; $index++; } for ( $i = 0; $i < size( $list ); $i++ ) { $miName = $attrName + "MenuItem" + $index; menuItem -l $list[$i] $miName; $index++; } // Select the default item. // optionMenuGrp -e -value $default $omName; } global proc dynCreateLayout(string $parent, string $theCmd, int $isCreate) { global int $dynIsCreate; $dynIsCreate = $isCreate; string $procName = ("create"+$theCmd+"Layout"); eval(($procName +" "+$parent)); } global proc createParticleRenderCacheLayout( string $parent ) { text -align left -l " "; text -align left -l "Once created, this cache will be used until you disable it."; text -align left -l "See Solvers | Edit Oversampling and Cache."; text -l " "; textFieldGrp -l "Cache Directory" particleRenderCacheDirectory; //text -l " "; text -align left -l "Directory is subdirectory of current project \"particles\" directory."; text -l " "; checkBoxGrp -l "Use Render Globals Range" -ncb 1 -l1 "" cacheForRenderGlobalsRange; //text -l " "; text -align left -l "If you check this item, Maya will cache for the current start/end"; text -align left -l "frames of the default render globals node. Otherwise, Maya will"; text -align left -l "use the current playback range."; text -l " "; text -align left -l "Maya will play the scene through the range being cached."; text -align left -l "Hit ESC to interrupt the caching operation."; text -l " "; checkBoxGrp -l "Only Update particles" -ncb 1 -l1 "" onlyUpdateParticles; text -l " "; } global proc dynVolumeFieldShapeOptionChoice( string $parent, string $field ) { setParent $parent; int $choice = `optionMenuGrp -q -sl ($field+"VolumeFieldTypesOM")`; // // None // Note - first entry in this enum counts as 1, not 0. if ($choice == 1) { // Disable all volume control attributes if ($field != "volumeAxis") checkBoxGrp -e -enable false ($field+"VolumeExclusion"); floatSliderGrp -e -enable false ($field+"VolumeOffsetX"); floatSliderGrp -e -enable false ($field+"VolumeOffsetY"); floatSliderGrp -e -enable false ($field+"VolumeOffsetZ"); floatSliderGrp -e -enable false ($field+"VolumeSweep"); floatSliderGrp -e -enable false ($field+"TorusSectionRadius"); if ($field == "volumeAxis") { floatSliderGrp -e -enable false ($field+"AlongAxis"); floatSliderGrp -e -enable false ($field+"AroundAxis"); floatSliderGrp -e -enable false ($field+"AwayFromAxis"); floatSliderGrp -e -enable false ($field+"AwayFromCenter"); //floatSliderGrp -e -enable false ($field+"RandomSpread"); floatSliderGrp -e -enable false ($field+"DirectionalSpeed"); } } else { if ($field != "volumeAxis") checkBoxGrp -e -enable true ($field+"VolumeExclusion"); floatSliderGrp -e -enable true ($field+"VolumeOffsetX"); floatSliderGrp -e -enable true ($field+"VolumeOffsetY"); floatSliderGrp -e -enable true ($field+"VolumeOffsetZ"); floatSliderGrp -e -enable true ($field+"VolumeSweep"); floatSliderGrp -e -enable false ($field+"TorusSectionRadius"); if ($choice == 2) floatSliderGrp -e -enable false ($field+"VolumeSweep"); else if ($choice == 6) floatSliderGrp -e -enable true ($field+"TorusSectionRadius"); // Enable colume axis speeds according to type. // if ($field == "volumeAxis") { floatSliderGrp -e -enable true ($field+"AlongAxis"); floatSliderGrp -e -enable true ($field+"AroundAxis"); //floatSliderGrp -e -enable true ($field+"RandomSpread"); floatSliderGrp -e -enable true ($field+"DirectionalSpeed"); if ($choice == 2 || $choice == 3) { floatSliderGrp -e -enable false ($field+"AwayFromAxis"); floatSliderGrp -e -enable true ($field+"AwayFromCenter"); } else { floatSliderGrp -e -enable true ($field+"AwayFromAxis"); floatSliderGrp -e -enable false ($field+"AwayFromCenter"); } } } } proc createMaxDistanceControlLayout( string $parent, string $field ) { global float $dynMaxFloatField; global float $dynMinFloatField; separator; checkBoxGrp -l "Use Max Distance" -ann "If false, field ignores max distance and extends without limit (subject to volume)" -ncb 1 -l1 "" -on1 ("dynMaxDistance "+$parent+" "+ $field + "MaxDistance 1") -of1 ("dynMaxDistance "+$parent+" "+ $field + "MaxDistance 0") ($field+"MaxDistCBox"); floatSliderGrp -label "Max Distance" -ann "Maximum distance at which field has an effect (subject to volume)" -field true -min 0.0 -max 100.0 -fmn 0 -fmx $dynMaxFloatField -pre 3-step 0.5 ($field+"MaxDistance"); } proc createMagAttControlLayout( string $parent, string $field ) { global float $dynMaxFloatField; global float $dynMinFloatField; floatSliderGrp -label "Magnitude" -ann "Strength of field force" -field true -min -100.0 -max 100.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 ($field+"Magnitude"); floatSliderGrp -label "Attenuation" -ann "Makes field strength diminish with distance" -field true -min 0.0 -max 10.0 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.5 ($field+"Attenuation"); } proc createVolumeFieldControlLayout( string $parent, string $field ) { global float $dynMaxFloatField; global float $dynMinFloatField; separator; //text -align left -l "Volume Control Attributes" // ($field+"VolumeText"); // ATTENTION: to remove the help text from the field option boxes, // comment out the following two lines. // text -align center -l "Volume determines the region where the field affects particles/rigid bodies."; optionMenuGrp -l "Volume Shape" -ann "Determines (with max distance) where field affects objects. If None, only max distance is used." -cc ("dynVolumeFieldShapeOptionChoice " + $parent + " " + $field) ($field+"VolumeFieldTypesOM"); menuItem -l "None" ($field+"VolumeNone"); menuItem -l "Cube" ($field+"VolumeCube"); menuItem -l "Sphere" ($field+"VolumeSphere"); menuItem -l "Cylinder" ($field+"VolumeCylinder"); menuItem -l "Cone" ($field+"VolumeCone"); menuItem -l "Torus" ($field+"VolumeTorus"); int $enabled = 0; if ($field != "volumeAxis") { checkBoxGrp -l "Volume Exclusion" -ann "Affect objects outside the volume instead of inside" -enable $enabled -ncb 1 -l1 "" ($field+"VolumeExclusion"); } floatSliderGrp -l "Volume Offset X" -ann "Move volume away from actual field location" -field true -enable $enabled -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 ($field+"VolumeOffsetX"); floatSliderGrp -l "Volume Offset Y" -ann "Move volume away from actual field location" -field true -enable $enabled -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 ($field+"VolumeOffsetY"); floatSliderGrp -l "Volume Offset Z" -ann "Move volume away from actual field location" -field true -enable $enabled -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 ($field+"VolumeOffsetZ"); floatSliderGrp -label "Volume Sweep" -ann "Change extent of volume, as in modelling" -field true -enable $enabled -min 0 -max 360 //-fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 3.6 ($field+"VolumeSweep"); floatSliderGrp -label "Section Radius" -ann "Change size of torus volume, as in modelling" -field true -enable $enabled -min 0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 ($field+"TorusSectionRadius"); // Make initial call to this routine to set up dimming. // For the volume axis field we delay doing this until // the main colume axis routine, when all the volume axis // controls are set up. // if ($field != "volumeAxis") dynVolumeFieldShapeOptionChoice( $parent, $field ); } global proc createAirLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Name Widget // textFieldGrp -l "Air Field Name" airName; separator; //text -align left -l "Predefined Settings" // airPresetsT; rowLayout -cat 1 "both" 20 -cat 2 "both" 20 -cat 3 "both" 20 -cw 1 140 -cw 2 140 -cw 3 140 -cal 1 "left" -nc 3 airPresetsRow; button -l "Wind" -al "center" -ann "Set option values to simulate wind" -c "dynAirPresetsCB 1" airWind; button -l "Wake" -al "center" -ann "Set option values to simulate the wake of a moving object" -c "dynAirPresetsCB 2" airWake; button -l "Fan" -al "center" -ann "Set option values to simulate a fan" -c "dynAirPresetsCB 3" airFan; setParent ..; separator airSep2; // Attribute Widgets // // Create our own widgets here because we want different help strings // string $field = "air"; floatSliderGrp -label "Magnitude" -ann "Strength of air current. Particles will come to match this speed." -field true -min -100.0 -max 100.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 ($field+"Magnitude"); floatSliderGrp -label "Attenuation" -ann "Makes magnitude diminish with distance" -field true -min 0.0 -max 10.0 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.5 ($field+"Attenuation"); string $dirAnnString = "Direction of the air flow"; floatSliderGrp -l "Direction X" -ann $dirAnnString -field true -min -1 -max 1 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 airDirectionX; floatSliderGrp -l "Direction Y" -ann $dirAnnString -field true -min -1 -max 1 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 airDirectionY; floatSliderGrp -l "Direction Z" -ann $dirAnnString -field true -min -1 -max 1 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 airDirectionZ; floatSliderGrp -l "Speed" -ann "How fast particles come to match the speed of the air current" -field true -min 0 -max 100 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 1.0 airSpeed; floatSliderGrp -l "Inherit Velocity" -ann "Amount of field's own velocity to add to the air flow" -field true -min 0 -max 1 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.1 airInheritVelocity; checkBoxGrp -l "Inherit Rotation" -ncb 1 -l1 "" -ann "If true, and air field is rotating, air flow undergoes that same rotation" airInheritRotation; checkBoxGrp -l "Component Only" -ann "If true, apply force only in the air flow direction" -ncb 1 -l1 "" airComponent; separator; //text -align left -l "Spread" // airSpreadText; checkBoxGrp -l "Enable Spread" -ann "Toggle spread on and off" -ncb 1 -l1 "" -on1 "dynAirEnableSpreadCB 1" -of1 "dynAirEnableSpreadCB 0" airEnableSpread; floatSliderGrp -l "Spread" -ann "Angle from the direction setting within which objects are affected" -field true -min 0 -max 1 -pre 3 -step 0.1 airSpread; createMaxDistanceControlLayout( $parent, "air" ); createVolumeFieldControlLayout( $parent, "air" ); } global proc createDragLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Drag Name Widget // textFieldGrp -l "Drag Field Name" dragName; createMagAttControlLayout( $parent, "drag" ); checkBoxGrp -l "Use Direction" -ann "Act only in a particular direction" -ncb 1 -l1 "" dragUseDirection; string $dirAnnString = "Act in this direction"; floatSliderGrp -label "X Direction" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 dragDirectionX; floatSliderGrp -label "Y Direction" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 dragDirectionY; floatSliderGrp -label "Z Direction" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 dragDirectionZ; createMaxDistanceControlLayout( $parent, "drag" ); createVolumeFieldControlLayout( $parent, "drag" ); } global proc createGravityLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Name Widget // textFieldGrp -l "Gravity Field Name" gravityName; createMagAttControlLayout( $parent, "gravity" ); string $dirAnnString = "Make objects fall in this direction"; floatSliderGrp -label "X Direction" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 gravityDirectionX; floatSliderGrp -label "Y Direction" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 gravityDirectionY; floatSliderGrp -label "Z Direction" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 gravityDirectionZ; createMaxDistanceControlLayout( $parent, "gravity" ); createVolumeFieldControlLayout( $parent, "gravity" ); } global proc createNewtonLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Name Widget // textFieldGrp -l "Newton Field Name" newtonName; createMagAttControlLayout( $parent, "newton" ); floatSliderGrp -l "Min Distance" -ann "Field will not act inside this distance. Use this to avoid wild motion for objects very near field location." -field true -min 0 -max 100 -fmn 0 -fmx $dynMaxFloatField -pre 3-step 0.5 newtonMinDistance; createMaxDistanceControlLayout( $parent, "newton" ); createVolumeFieldControlLayout( $parent, "newton" ); } global proc createRadialLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Name Widget // textFieldGrp -l "Radial Field Name" radialName; createMagAttControlLayout( $parent, "radial" ); floatSliderGrp -label "Radial Type" -ann "If 0, attenuation will decrease magnitude smoothly to 0 at max distance" -field true -min 0.0 -max 1.0 radialType; createMaxDistanceControlLayout( $parent, "radial" ); createVolumeFieldControlLayout( $parent, "radial" ); } global proc createTurbulenceLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Name Widget // textFieldGrp -l "Turbulence Field Name" turbulenceName; createMagAttControlLayout( $parent, "turbulence" ); floatSliderGrp -label "Frequency" -ann "Greater value causes more frequent irregularities in the motion" -field true -min 0.0 -max 100.0 -fmn 0 -fmx $dynMaxFloatField -pre 3-step 0.5 turbulenceFrequency; floatSliderGrp -label "Phase X" -ann "Influences disruption along the x axis" -field true -min -50.0 -max 50.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3-step 0.5 turbulencePhaseX; floatSliderGrp -label "Phase Y" -ann "Influences disruption along the y axis" -field true -min -50.0 -max 50.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3-step 0.5 turbulencePhaseY; floatSliderGrp -label "Phase Z" -ann "Influences disruption along the z axis" -field true -min -50.0 -max 50.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 turbulencePhaseZ; intSliderGrp -label "Noise Level" -ann "Determines number of noise lookups, and thus the amount of irregularity" -field true -min 0 -max 50 -fmx $dynMaxFloatField //-pre 3 -step 1.0 turbulenceNoiseLevel; floatSliderGrp -label "Noise Ratio" -ann "Determines weighting of successive noise lookups" -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 turbulenceNoiseRatio; createMaxDistanceControlLayout( $parent, "turbulence" ); createVolumeFieldControlLayout( $parent, "turbulence" ); } global proc createUniformLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Name Widget // textFieldGrp -l "Uniform Field Name" uniformName; createMagAttControlLayout( $parent, "uniform" ); string $dirAnnString = "Make objects move in this direction"; floatSliderGrp -label "Direction X" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 uniformDirectionX; floatSliderGrp -label "Direction Y" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 uniformDirectionY; floatSliderGrp -label "Direction Z" -ann $dirAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 uniformDirectionZ; createMaxDistanceControlLayout( $parent, "uniform" ); createVolumeFieldControlLayout( $parent, "uniform" ); } global proc createVortexLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Name Widget // textFieldGrp -l "Vortex Field Name" vortexName; createMagAttControlLayout( $parent, "vortex" ); string $axisAnnString = "Make objects revolve around this axis"; floatSliderGrp -label "Axis X" -ann $axisAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 vortexAxisX; floatSliderGrp -label "Axis Y" -ann $axisAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 vortexAxisY; floatSliderGrp -label "Axis Z" -ann $axisAnnString -field true -min -1.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 vortexAxisZ; separator; createMaxDistanceControlLayout( $parent, "vortex" ); createVolumeFieldControlLayout( $parent, "vortex" ); } global proc createVolumeAxisLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Name Widget // textFieldGrp -l "Volume Axis Field Name" volumeAxisName; createMagAttControlLayout( $parent, "volumeAxis" ); createMaxDistanceControlLayout( $parent, "volumeAxis" ); createVolumeFieldControlLayout( $parent, "volumeAxis" ); separator; checkBoxGrp -l "Invert Attenuation" -ann "If true and attenuation is greater than 0.0, field effect increases with distance." -ncb 1 -l1 "" -enable 1 volumeAxisInvertAttenuation; floatSliderGrp -label "Away From Center" -ann "Make particles move directly away from volume center point" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisAwayFromCenter; floatSliderGrp -label "Away From Axis" -ann "Make particles move directly away from volume axis" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisAwayFromAxis; floatSliderGrp -label "Along Axis" -ann "Make particles move along volume axis" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisAlongAxis; floatSliderGrp -label "Around Axis" -ann "Make particles rotate around volume axis" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisAroundAxis; //floatSliderGrp -label "Random Direction" // -ann "Adds to particle motion a component of this length in random direction" // -field true // -min -10 -max 10 // -fmn $dynMinFloatField -fmx $dynMaxFloatField // -pre 3 -step 0.5 // volumeAxisRandomSpread; floatSliderGrp -label "Directional Speed" -ann "Adds to particle motion a component of this length in directionX/Y/Z" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisDirectionalSpeed; floatSliderGrp -label "DirectionX" -ann "Push particles in this direction" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisDirectionX; floatSliderGrp -label "DirectionY" -ann "Emit particles in this direction" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisDirectionY; floatSliderGrp -label "DirectionZ" -ann "Emit particles in this direction" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisDirectionZ; floatSliderGrp -label "Turbulence" -ann "Simulate an animated turbulent wind field" -field true -min 0 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulence; floatSliderGrp -label "Turbulence Speed" -ann "Rate of change of turbulence over time." -field true -min 0 -max 1 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceSpeed; floatSliderGrp -label "Turbulence Frequency X" -ann "Repeats in X of turbulence function" -field true -min 0 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceFrequencyX; floatSliderGrp -label "Turbulence Frequency Y" -ann "Repeats in Y of turbulence function" -field true -min 0 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceFrequencyY; floatSliderGrp -label "Turbulence Frequency Z" -ann "Repeats in Z of turbulence function" -field true -min 0 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceFrequencyZ; floatSliderGrp -label "Turbulence Offset X" -ann "Translation in X of turbulence function" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceOffsetX; floatSliderGrp -label "Turbulence Offset Y" -ann "Translation in Y of turbulence function" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceOffsetY; floatSliderGrp -label "Turbulence Offset Z" -ann "Translation in Z of turbulence function" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisTurbulenceOffsetZ; floatSliderGrp -label "Detail Turbulence" -ann "The relative intensity of a second higher frequency turbulence." -field true -min 0 -max 1 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 volumeAxisDetailTurbulence; // initialize the dimming // dynVolumeFieldShapeOptionChoice( $parent, "volumeAxis" ); } global proc createEmitterLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; global int $dynIsCreate; setParent $parent; // Emitter Name Widget // textFieldGrp -l "Emitter Name" emitterName; // Basic Emitter Attributes Layout // frameLayout -l "Basic Emitter Attributes" -bv true -lv true -cll true -cl false -mh 4 emitterBasicFL; columnLayout emitterBasicCL; // Emitter Types Option Menu // optionMenuGrp -l "Emitter Type" -cc ("dynEmitterOptionChoice " + $parent) emitterTypesOM; menuItem -l "Omni" emitterOmniPoint; menuItem -l "Directional" emitterDirPoint; if (!$dynIsCreate) { menuItem -l "Surface" emitterSurface; menuItem -l "Curve" emitterCurve; // If user is switching to add emitter, and previously // the user had set the emitterTypesOM to 5 (volume), // then it must be set to something valid, so set to omni. // if (`optionVar -exists emitterTypesOM` && (`optionVar -query emitterTypesOM` == 5)) { optionVar -intValue emitterTypesOM 1; } } else { menuItem -l "Volume" emitterVolume; // If user is switching to create emitter, and previously // the user had set the emitterTypesOM to 3 (surface) or // 4 (curve) in // add emitter mode, then it must be reset to something // valid, so set it to omni. // if (`optionVar -exists emitterTypesOM` && ((`optionVar -query emitterTypesOM` == 3) || (`optionVar -query emitterTypesOM` == 4))) { optionVar -intValue emitterTypesOM 1; } } floatSliderGrp -l "Rate (Particles/Sec)" -ann "Number of particles to create per second" -field true -min 0 -max 500 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 10 emitterRate; checkBoxGrp -l "Scale Rate By Object Size" -ann "If false, scaling object doesn't change number of particles emitted" -ncb 1 -l1 "" emitterScaleRateByObjectSize; checkBoxGrp -l "Need Parent UV (NURBS)" -ann "Record parent (u,v) data. Must also add parentU/parentV to particle shape. NURBS surfaces only." -ncb 1 -l1 "" emitterNeedParentUV; optionMenuGrp -l "Cycle Emission" -ann "Restart random stream for this emitter each frame or after some number of particles" -cc ("dynEmitterCycleOptionChoice " + $parent) emitterCycleOM; menuItem -l "None (timeRandom off)" emitterCycleNone; menuItem -l "Frame (timeRandom on)" emitterCycleFrame; // menuItem -l "By Particle Count" emitterCycleCount; intSliderGrp -l "Cycle Interval" -ann "Number of frames/particles between restarts of random stream" -field true -min 1 -max 100 -fmx $dynMaxFloatField //-pre 3 -step 0.5 emitterCycleInterval; setParent ..; setParent ..; // Direction Layout // frameLayout -l "Distance/Direction Attributes" -bv true -lv true -cll true -cl true -mh 4 emitterDirectionFL; columnLayout emitterDirectionCL; floatSliderGrp -l "Max Distance" -ann "Emit particles in a sphere bounded by this distance (does not apply to volumes)" -field true -min 0 -max 10 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.5 -cc emitterMaxDistCB emitterMaxDistance; floatSliderGrp -l "Min Distance" -ann "Emit particles in a sphere bounded by this distance (does not apply to volumes)" -field true -min 0 -max 10 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.5 -cc emitterMinDistCB emitterMinDistance; floatSliderGrp -label "DirectionX" -ann "Emit particles in this direction" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterDirectionX; floatSliderGrp -label "DirectionY" -ann "Emit particles in this direction" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterDirectionY; floatSliderGrp -label "DirectionZ" -ann "Emit particles in this direction" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterDirectionZ; floatSliderGrp -l "Spread" -ann "Randomize the directions of particles" -field true -min 0 -max 1 -pre 3 -step 0.1 emitterSpread; setParent ..; setParent ..; // Basic Emission Speed // frameLayout -l "Basic Emission Speed Attributes" -bv true -lv true -cll true -cl false -mh 4 emitterSpeedFL; columnLayout emitterSpeedCL; floatSliderGrp -l "Speed" -ann "Make particles move faster. Does not apply to volume emitters" -field true -min 0 -max 10 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.1 emitterSpeed; floatSliderGrp -l "Speed Random" -ann "Randomize the speeds of particles up to plus or minus one-half this value" -field true -min 0 -max 10 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.1 emitterSpeedRandomRange; floatSliderGrp -l "Tangent Speed" -ann "Makes particles move randomly along curve or surface" -field true -min 0 -max 10 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.1 emitterTangentSpeed; floatSliderGrp -l "Normal Speed" -ann "Makes particles move directly away from curve or surface" -field true -min 0 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 emitterNormalSpeed; setParent ..; setParent ..; // Volume Emitter Attributes Layout // int $collapse = 0; frameLayout -l "Volume Emitter Attributes" -bv true -lv true -cll true -cl $collapse -mh 4 emitterVolumeFL; columnLayout emitterVolumeCL; text -align left -l "Set emitter type to Volume to enable" emitterVolumeEnablePrompt; optionMenuGrp -l "Volume Shape" -ann "Determines where particles are created (for volume type emitter, only)" -cc ("setDimmingForVolumeEmitterAttributes " + $parent) emitterVolumeShapeOM; menuItem -l "Cube" emitterCube; menuItem -l "Sphere" emitterSphere; menuItem -l "Cylinder" emitterCylinder; menuItem -l "Cone" emitterCone; menuItem -l "Torus" emitterTorus; floatSliderGrp -label "Volume Offset X" -ann "Move volume away from actual emitter location" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterVolumeOffsetX; floatSliderGrp -label "Volume Offset Y" -ann "Move volume away from actual emitter location" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterVolumeOffsetY; floatSliderGrp -label "Volume Offset Z" -ann "Move volume away from actual emitter location" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterVolumeOffsetZ; floatSliderGrp -label "Volume Sweep" -ann "Change extent of volume, as in modelling" -field true -min 0 -max 360 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 3.6 emitterVolumeSweep; floatSliderGrp -label "Section Radius" -ann "Change size of torus volume, as in modelling" -field true -min 0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 emitterTorusSectionRadius; string $os = `about -os`; if ($os == "irix") { // On Irix, the text of the label does not fit without reformatting // so give it a slightly nonstandard layout. // checkBoxGrp -l "Die on Emission Volume Exit" -cw2 175 200 -ncb 1 -l1 "" emitterDieOnExit; } else { checkBoxGrp -l "Die on Emission Volume Exit" -ncb 1 -l1 "" emitterDieOnExit; } checkBoxGrp -e -ann "If true, particles die on exiting volume. After creating emitter, this attribute can be found in the particle's attribute editor under Emission Attributes." emitterDieOnExit; setParent ..; setParent ..; // Volume Speed Attributes Layout // frameLayout -l "Volume Speed Attributes" -bv true -lv true -cll true -cl $collapse -mh 4 emitterVolumeSpeedFL; columnLayout emitterVolumeSpeedCL; text -align left -l "Set emitter type to Volume to enable" emitterVolumeSpeedEnablePrompt; floatSliderGrp -label "Away From Center" -ann "Make particles move directly away from volume center point" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterAwayFromCenter; floatSliderGrp -label "Away From Axis" -ann "Make particles move directly away from volume axis" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterAwayFromAxis; floatSliderGrp -label "Along Axis" -ann "Make particles move along volume axis" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterAlongAxis; floatSliderGrp -label "Around Axis" -ann "Make particles rotate around volume axis" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterAroundAxis; floatSliderGrp -label "Random Direction" -ann "Adds to particle motion a component of this length in random direction" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterRandomSpread; floatSliderGrp -label "Directional Speed" -ann "Adds to particle motion a component of this length in directionX/Y/Z" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 emitterDirectionalSpeed; checkBoxGrp -l "Scale Speed By Size" -ann "If true, scaling volume changes particle speed" -ncb 1 -l1 "" emitterScaleSpeedBySize; setParent ..; setParent ..; } global proc createCollisionLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; setParent $parent; // Drag Name Widget // floatSliderGrp -label "Resilience" -field true -min 0.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 collisionResilience; floatSliderGrp -label "Friction" -field true -min 0.0 -max 1.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 collisionFriction; } global proc createGoalLayout( string $parent ) { setParent $parent; floatSliderGrp -label "Goal Weight" -field true -min 0.0 -max 1.0 -pre 3 -step 0.1 goalWeight; checkBoxGrp -label "Use Transform as Goal" -ncb 1 -l1 "" goalUseTransform; } global proc createRigidLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; setParent $parent; // Rigid Body Name Widget // textFieldGrp -l "Rigid Body Name" rigidName; // Rigid Body Attributes Layout // frameLayout -l "Rigid Body Attributes" -bv true -lv true -cll true -cl false -mh 4 rigidBodyAttrsF; columnLayout rigidBodyAttrsCL; // Rigid Body Attributes Widgets // checkBoxGrp -l "" -ncb 2 -l1 "Active" -l2 "Particle Collision" rigidActiveCollision; floatSliderGrp -l "Mass" -field true -min 0 -max 100 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidMass; checkBoxGrp -l "Set Center of Mass" -ncb 1 -l1 "" -onc "dynRigidComCB 1" -ofc "dynRigidComCB 0" rigidComCBox; floatSliderGrp -label "Center of Mass: X" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidComX; floatSliderGrp -label "Y" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidComY; floatSliderGrp -label "Z" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidComZ; floatSliderGrp -l "Static Friction" -field true -min 0.0 -max 1.0 -pre 3 -step 0.1 rigidStatFriction; floatSliderGrp -l "Dynamic Friction" -field true -min 0.0 -max 1.0 -pre 3 -step 0.1 rigidDynFriction; floatSliderGrp -l "Bounciness" -field true -min 0.0 -max 2.0 -pre 3 -step 0.1 rigidBounciness; floatSliderGrp -l "Damping" -field true -min -2.0 -max 2.0 -pre 3 -step 0.1 rigidDamping; floatSliderGrp -label "Impulse: X" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidImpulseX; floatSliderGrp -label "Y" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidImpulseY; floatSliderGrp -label "Z" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidImpulseZ; floatSliderGrp -label "Impulse Position: X" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidImpulsePosX; floatSliderGrp -label "Y" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidImpulsePosY; floatSliderGrp -label "Z" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidImpulsePosZ; floatSliderGrp -label "Spin Impulse: X" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidSpinImpulseX; floatSliderGrp -label "Y" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidSpinImpulseY; floatSliderGrp -label "Z" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidSpinImpulseZ; setParent ..; setParent ..; frameLayout -l "Initial Settings" -bv true -lv true -cll true -cl true -mh 4 rigidInitialSettingsF; columnLayout rigidInitialSettingsCL; floatSliderGrp -l "Initial Spin: X" -field true -min -10.0 -max 10.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidAngVelocityX; floatSliderGrp -l "Y" -field true -min -10.0 -max 10.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidAngVelocityY; floatSliderGrp -l "Z" -field true -min -10.0 -max 10.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidAngVelocityZ; checkBoxGrp -l "Set Initial Position" -ncb 1 -l1 "" -onc "dynRigidPositionCB 1" -ofc "dynRigidPositionCB 0" rigidPosCBox; floatSliderGrp -label "Initial Position: X" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidPosX; floatSliderGrp -label "Y" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidPosY; floatSliderGrp -label "Z" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidPosZ; checkBoxGrp -l "Set Initial Orientation" -ncb 1 -l1 "" -onc "dynRigidOrientCB 1" -ofc "dynRigidOrientCB 0" rigidOrCBox; floatSliderGrp -label "Initial Orientation: X" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidOrX; floatSliderGrp -label "Y" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidOrY; floatSliderGrp -label "Z" -field true -min -10 -max 10 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidOrZ; floatSliderGrp -l "Initial Velocity: X" -field true -min -10.0 -max 10.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidInitVelocityX; floatSliderGrp -l "Y" -field true -min -10.0 -max 10.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidInitVelocityY; floatSliderGrp -l "Z" -field true -min -10.0 -max 10.0 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.5 rigidInitVelocityZ; setParent ..; setParent ..; frameLayout -l "Performance Attributes" -bv true -lv true -cll true -cl true -mh 4 rigidPerfAttrsF; columnLayout rigidPerfAttrsF; // Collision Types Radio Buttons // optionMenuGrp -l "Stand In" rigidStandInType; menuItem -l "None" standInNone; menuItem -l "Cube" standInCube; menuItem -l "Sphere" standInSphere; intFieldGrp -l "Tessellation Factor" -nf 1 rigidTesselation; intFieldGrp -l "Collision Layer" -nf 1 rigidLayer; separator; checkBoxGrp -l "Cache Data" -ncb 1 -l1 "" rigidCacheCBox; } global proc createSoftLayout( string $parent ) { setParent $parent; // Name Widget // // How to make soft Body optionMenuGrp -l "Creation Options" -cc softCBoxCB softCreationOption; menuItem -l "Make Soft" softConvert; menuItem -l "Duplicate, Make Copy Soft" softDuplicate; menuItem -l "Duplicate, Make Original Soft" softConvertAndDuplicate; checkBoxGrp -label "Duplicate Input Graph" -numberOfCheckBoxes 1 -label1 "" softHistory; checkBoxGrp -l "Hide Non-Soft Object" -ncb 1 -l1 "" softHide; checkBoxGrp -l "Make Non-Soft a Goal" -ncb 1 -l1 "" -onc "softGoalCB 1" -ofc "softGoalCB 0" softGoal; floatSliderGrp -label "Weight" -field true -min 0.0 -max 1.0 -pre 3 -step 0.1 softWeight; } global proc createConstrainLayout( string $parent ) { global float $dynMaxFloatField; global float $dynMinFloatField; setParent $parent; // Constrain Name Widget // textFieldGrp -l "Constraint Name" constrainName; separator constrainTypeSep; optionMenuGrp -l "Constraint Type:" -cc dynConstraintTypeCB constrainTypesOM; menuItem -l "Nail" constrainNail; menuItem -l "Pin" constrainPin; menuItem -l "Hinge" constrainHinge; menuItem -l "Spring" constrainSpring; menuItem -l "Barrier" constrainBarrier; // Constrain Interpenetrate Checkbox // checkBoxGrp -l "Interpenetrate" -ncb 1 -l1 "" constrainInterCB; separator constrainPosSep; checkBoxGrp -l "Set Initial Position" -ncb 1 -l1 "" -onc "dynConstraintPositionCB 1" -ofc "dynConstraintPositionCB 0" constrainPosCBox; text -l "Initial Position" constrainPosT; // Constrain Position Sliders // floatSliderGrp -label "X " -field true -min -100 -max 100 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 1 constrainPosX; floatSliderGrp -label "Y " -field true -min -100 -max 100 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 1 constrainPosY; floatSliderGrp -label "Z " -field true -min -100 -max 100 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 1 constrainPosZ; text -l "Initial Orientation" constrainOrientT; // Constrain Orientation Sliders // floatSliderGrp -label "X " -field true -min -100 -max 100 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 1 constrainOrientX; floatSliderGrp -label "Y " -field true -min -100 -max 100 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 1 constrainOrientY; floatSliderGrp -label "Z " -field true -min -100 -max 100 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 1 constrainOrientZ; // Spring Attribute Sliders // frameLayout -l "Spring Attributes" -bv true -lv true -cll true -cl true -mh 4 constraintSpringFL; columnLayout constraintSpringCL; floatSliderGrp -label "Stiffness" -field true -min 0 -max 10 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.1 constrainSpringStiffness; floatSliderGrp -label "Damping" -field true -min 0 -max 5 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 constrainSpringDamping; checkBoxGrp -l "Set Spring Rest Length" -ncb 1 -l1 "" -onc "dynConstrainSpringRestLengthCB 1" -ofc "dynConstrainSpringRestLengthCB 0" constrainSpringRestLengthCBox; floatSliderGrp -label "Rest Length" -field true -min 0 -max 100 -fmn $dynMinFloatField -fmx $dynMaxFloatField -pre 3 -step 0.1 constrainSpringRestLength; setParent ..; setParent ..; } global proc createSpringLayout( string $parent ) { // These globals contain the lowest min and highest max for the // dynamics float fields. // global float $dynMaxFloatField; global float $dynMinFloatField; setParent $parent; columnLayout -adj true -columnAttach "both" 5 -columnOffset "both" 5; // Name Widget // textFieldGrp -l "Spring Name" springName; frameLayout -l "Spring Methods" -labelAlign "bottom" -collapsable true -collapse false; columnLayout; checkBoxGrp -l "Add to Existing Spring" -ncb 1 -l1 "" -on1 "springAddCB 1" -of1 "springAddCB 0" springAdd; checkBoxGrp -l "Don't Duplicate Springs" -ncb 1 -l1 "" springNoDuplicate; checkBoxGrp -l "Set Exclusive" -ncb 1 -l1 "" springExclusive; optionMenuGrp -l "Creation Method:" -cc ("dynSpringOptionChoiceCB " + $parent) springMethodsOM; menuItem -l "MinMax" springMinMax; menuItem -l "All" springAll; menuItem -l "Wireframe" springWirefram; floatSliderGrp -l "Min Distance" -field true -min 0 -max 100 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.5 -cc springMinDistCB springMinDistance; floatSliderGrp -l "Max Distance" -field true -min 0 -max 100 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.5 -cc springMaxDistCB springMaxDistance; intFieldGrp -l "Wire Walk Length" -nf 1 springWireWalkLength; setParent ..; setParent ..; frameLayout -l "Spring Attributes" -labelAlign "bottom" -collapsable true -collapse false; columnLayout; checkBoxGrp -l "Use Per-Spring Stiffness" -ncb 1 -l1 "" -on1 "springUseStiffnessPSCB 1" -of1 "springUseStiffnessPSCB 0" springUseStiffnessPS; checkBoxGrp -l "Use Per-Spring Damping" -ncb 1 -l1 "" -on1 "springUseDampingPSCB 1 " -of1 "springUseDampingPSCB 0" springUseDampingPS; checkBoxGrp -l "Use Per-Spring RestLength" -ncb 1 -l1 "" -on1 "springUseRestLengthPSCB 1" -of1 "springUseRestLengthPSCB 0" springUseRestLengthPS; floatSliderGrp -label "Stiffness" -field true -min 0 -max 20 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.1 springStiffness; floatSliderGrp -l "Damping" -field true -min 0 -max 20 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.1 springDamp; floatSliderGrp -l "Rest Length" -field true -min 0 -max 20 -fmn 0 -fmx $dynMaxFloatField -pre 3 -step 0.1 springRestLength; floatSliderGrp -l "End1 Weight" -field true -min 0 -max 1 -pre 3 -step 0.1 springStartForceWeight; floatSliderGrp -l "End2 Weight" -field true -min 0 -max 1 -pre 3 -step 0.1 springEndForceWeight; setParent ..; setParent ..; setParent ..; setParent ..; } global proc string getSelectedParticle() { string $selectedParticle = ""; string $relativeList[]; string $selectionList[] = `ls -sl`; int $listCount = size( $selectionList ); for ( $i = 0; $i < $listCount; $i++ ) { string $typeList[] = `ls -st $selectionList[$i]`; if ( $typeList[1] == "particle" ) { $selectedParticle = $typeList[0]; break; } else if ( $typeList[1] == "transform" ) { $relativeList = `listRelatives $selectionList[$i]`; for ( $j = 0; $j < size( $relativeList ); $j++ ) { $typeList = `ls -st $relativeList[$j]`; if ( $typeList[1] == "particle" ) { $selectedParticle = $typeList[0]; break; } } } } return $selectedParticle; } // =================== INTERNAL CONTROL CALLBACKS =============== // // global proc dynAirEnableSpreadCB(int $isSpreadOn) { if ($isSpreadOn) floatSliderGrp -e -enable true airSpread; else floatSliderGrp -e -enable false airSpread; } global proc dynAirPresetsCB(int $whichPreset) { if ($whichPreset == 1) { // Wind // floatSliderGrp -e -v 0.0 airInheritVelocity; checkBoxGrp -e -v1 1 airInheritRotation; checkBoxGrp -e -v1 0 airComponent; checkBoxGrp -e -v1 0 airEnableSpread; floatSliderGrp -e -enable false airSpread; floatSliderGrp -e -v 0.5 airSpeed; floatSliderGrp -e -v 5.0 airMagnitude; checkBoxGrp -e -v1 1 airMaxDistCBox; floatSliderGrp -e -v 20.0 -enable true airMaxDistance; } else if ($whichPreset == 2) { // Wake // floatSliderGrp -e -v 1.0 airInheritVelocity; checkBoxGrp -e -v1 0 airInheritRotation; checkBoxGrp -e -v1 1 airComponent; checkBoxGrp -e -v1 0 airEnableSpread; floatSliderGrp -e -enable false airSpread; floatSliderGrp -e -v 0.5 airSpeed; floatSliderGrp -e -v 0.0 airMagnitude; checkBoxGrp -e -v1 1 airMaxDistCBox; floatSliderGrp -e -v 2.0 -enable true airMaxDistance; } else if ($whichPreset == 3) { // Fan // floatSliderGrp -e -v 1.0 airInheritVelocity; checkBoxGrp -e -v1 1 airInheritRotation; checkBoxGrp -e -v1 0 airComponent; checkBoxGrp -e -v1 1 airEnableSpread; floatSliderGrp -e -enable true airSpread; floatSliderGrp -e -v 0.5 airSpread; floatSliderGrp -e -v 0.5 airSpeed; floatSliderGrp -e -v 5.0 airMagnitude; checkBoxGrp -e -v1 1 airMaxDistCBox; floatSliderGrp -e -v 20.0 -enable true airMaxDistance; } } global proc dynEmitterCycleOptionChoice(string $parent) { setParent $parent; int $choice = `optionMenuGrp -q -sl emitterCycleOM`; if ($choice == 1) // no cycling { intSliderGrp -e -enable false emitterCycleInterval; } else { intSliderGrp -e -enable true emitterCycleInterval; } } global proc setDimmingForVolumeEmitterAttributes( string $parent ) { global int $dynIsCreate; setParent $parent; int $type = `optionMenuGrp -q -sl emitterTypesOM`; // If we are doing create, then emitterTypesOM has values 1,2,3, // and value 3 is volume. // if (($dynIsCreate) && ($type == 3)) $type = 5; if ($type != 5) { // Non-volume type. Disable all volume controls. // optionMenuGrp -e -enable false emitterVolumeShapeOM; floatSliderGrp -e -enable false emitterVolumeOffsetX; floatSliderGrp -e -enable false emitterVolumeOffsetY; floatSliderGrp -e -enable false emitterVolumeOffsetZ; floatSliderGrp -e -enable false emitterVolumeSweep; floatSliderGrp -e -enable false emitterTorusSectionRadius; floatSliderGrp -e -enable false emitterAwayFromCenter; floatSliderGrp -e -enable false emitterAwayFromAxis; floatSliderGrp -e -enable false emitterAlongAxis; floatSliderGrp -e -enable false emitterAroundAxis; floatSliderGrp -e -enable false emitterRandomSpread; floatSliderGrp -e -enable false emitterDirectionalSpeed; checkBoxGrp -e -enable false emitterDieOnExit; checkBoxGrp -e -enable false emitterScaleSpeedBySize; text -e -enable true emitterVolumeEnablePrompt; text -e -enable true emitterVolumeSpeedEnablePrompt; } else { // Volume type. // Set all volume controls to defaults, first // optionMenuGrp -e -enable true emitterVolumeShapeOM; floatSliderGrp -e -enable true emitterVolumeOffsetX; floatSliderGrp -e -enable true emitterVolumeOffsetY; floatSliderGrp -e -enable true emitterVolumeOffsetZ; floatSliderGrp -e -enable true emitterVolumeSweep; floatSliderGrp -e -enable false emitterTorusSectionRadius; floatSliderGrp -e -enable true emitterAwayFromCenter; floatSliderGrp -e -enable true emitterAwayFromAxis; floatSliderGrp -e -enable true emitterAlongAxis; floatSliderGrp -e -enable true emitterAroundAxis; floatSliderGrp -e -enable true emitterRandomSpread; floatSliderGrp -e -enable true emitterDirectionalSpeed; checkBoxGrp -e -enable true emitterDieOnExit; checkBoxGrp -e -enable true emitterScaleSpeedBySize; text -e -enable false emitterVolumeEnablePrompt; text -e -enable false emitterVolumeSpeedEnablePrompt; int $volShape = `optionMenuGrp -q -sl emitterVolumeShapeOM`; // Now disable selected ones as necessary // if ($volShape == 1) // cube { floatSliderGrp -e -enable false emitterAwayFromAxis; floatSliderGrp -e -enable false emitterVolumeSweep; } else if ($volShape == 2) // sphere { floatSliderGrp -e -enable false emitterAwayFromAxis; } else if ($volShape == 3) // cylinder { floatSliderGrp -e -enable false emitterAwayFromCenter; } else if ($volShape == 4) // cone { floatSliderGrp -e -enable false emitterAwayFromCenter; } else if ($volShape == 5) // torus { floatSliderGrp -e -enable false emitterAwayFromCenter; floatSliderGrp -e -enable true emitterTorusSectionRadius; } } } global proc dynEmitterOptionChoice(string $parent) { setParent $parent; global int $dynIsCreate; int $choice = `optionMenuGrp -q -sl emitterTypesOM`; // If we are doing create, then emitterTypesOM has values 1,2,3, // and value 3 is volume. // if (($dynIsCreate) && ($choice == 3)) $choice = 5; floatSliderGrp -e -enable true emitterSpeed; // Omni Point // if ($choice == 1) { checkBoxGrp -e -enable false emitterNeedParentUV; checkBoxGrp -e -enable false emitterScaleRateByObjectSize; floatSliderGrp -e -enable true emitterMinDistance; floatSliderGrp -e -enable true emitterMaxDistance; floatSliderGrp -e -enable false emitterDirectionX; floatSliderGrp -e -enable false emitterDirectionY; floatSliderGrp -e -enable false emitterDirectionZ; floatSliderGrp -e -enable false emitterSpread; floatSliderGrp -e -enable false emitterNormalSpeed; floatSliderGrp -e -enable false emitterTangentSpeed; } // Directional Point // else if ($choice == 2) { checkBoxGrp -e -enable false emitterNeedParentUV; checkBoxGrp -e -enable false emitterScaleRateByObjectSize; floatSliderGrp -e -enable true emitterMinDistance; floatSliderGrp -e -enable true emitterMaxDistance; floatSliderGrp -e -enable true emitterDirectionX; floatSliderGrp -e -enable true emitterDirectionY; floatSliderGrp -e -enable true emitterDirectionZ; floatSliderGrp -e -enable true emitterSpread; floatSliderGrp -e -enable false emitterNormalSpeed; floatSliderGrp -e -enable false emitterTangentSpeed; } // Surface // else if ($choice == 3) { checkBoxGrp -e -enable true emitterNeedParentUV; checkBoxGrp -e -enable true emitterScaleRateByObjectSize; floatSliderGrp -e -enable true emitterMinDistance; floatSliderGrp -e -enable true emitterMaxDistance; floatSliderGrp -e -enable false emitterDirectionX; floatSliderGrp -e -enable false emitterDirectionY; floatSliderGrp -e -enable false emitterDirectionZ; floatSliderGrp -e -enable false emitterSpread; floatSliderGrp -e -enable true emitterNormalSpeed; floatSliderGrp -e -enable true emitterTangentSpeed; } // Curve // else if ($choice == 4) { checkBoxGrp -e -enable false emitterNeedParentUV; checkBoxGrp -e -enable true emitterScaleRateByObjectSize; floatSliderGrp -e -enable true emitterMinDistance; floatSliderGrp -e -enable true emitterMaxDistance; floatSliderGrp -e -enable true emitterDirectionX; floatSliderGrp -e -enable true emitterDirectionY; floatSliderGrp -e -enable true emitterDirectionZ; floatSliderGrp -e -enable true emitterSpread; floatSliderGrp -e -enable true emitterNormalSpeed; floatSliderGrp -e -enable true emitterTangentSpeed; } // Volume // else if ($choice == 5) { floatSliderGrp -e -enable false emitterSpeed; checkBoxGrp -e -enable false emitterNeedParentUV; checkBoxGrp -e -enable true emitterScaleRateByObjectSize; floatSliderGrp -e -enable false emitterMinDistance; floatSliderGrp -e -enable false emitterMaxDistance; floatSliderGrp -e -enable true emitterDirectionX; floatSliderGrp -e -enable true emitterDirectionY; floatSliderGrp -e -enable true emitterDirectionZ; floatSliderGrp -e -enable false emitterSpread; floatSliderGrp -e -enable false emitterNormalSpeed; floatSliderGrp -e -enable false emitterTangentSpeed; } setDimmingForVolumeEmitterAttributes( $parent ); } global proc emitterMaxDistCB() { // If the user sets max distance less than min distance, // reset min distance to be the same as max distance. // float $minDist = `floatSliderGrp -q -v emitterMinDistance`; float $maxDist = `floatSliderGrp -q -v emitterMaxDistance`; if ($maxDist < $minDist) { floatSliderGrp -e -v $maxDist emitterMinDistance; } } global proc emitterMinDistCB() { // If the user sets min distance greater than max distance, // reset max distance to be the same as min distance. // float $minDist = `floatSliderGrp -q -v emitterMinDistance`; float $maxDist = `floatSliderGrp -q -v emitterMaxDistance`; if ($minDist > $maxDist) { floatSliderGrp -e -v $minDist emitterMaxDistance; } } global proc dynRigidPositionCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true rigidPosX; floatSliderGrp -e -enable true rigidPosY; floatSliderGrp -e -enable true rigidPosZ; } else { floatSliderGrp -e -enable false rigidPosX; floatSliderGrp -e -enable false rigidPosY; floatSliderGrp -e -enable false rigidPosZ; } } global proc dynRigidOrientCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true rigidOrX; floatSliderGrp -e -enable true rigidOrY; floatSliderGrp -e -enable true rigidOrZ; } else { floatSliderGrp -e -enable false rigidOrX; floatSliderGrp -e -enable false rigidOrY; floatSliderGrp -e -enable false rigidOrZ; } } global proc dynRigidComCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true rigidComX; floatSliderGrp -e -enable true rigidComY; floatSliderGrp -e -enable true rigidComZ; } else { floatSliderGrp -e -enable false rigidComX; floatSliderGrp -e -enable false rigidComY; floatSliderGrp -e -enable false rigidComZ; } } global proc dynConstraintEnableInterpenetrate(int $enable) { if ($enable) { checkBoxGrp -e -enable true constrainInterCB; } else { checkBoxGrp -e -enable false constrainInterCB; } } global proc dynConstraintEnableSpring( int $enable) { if ($enable) { floatSliderGrp -e -enable true constrainSpringStiffness; floatSliderGrp -e -enable true constrainSpringDamping; checkBoxGrp -e -enable true constrainSpringRestLengthCBox; if (`optionVar -q constrainSpringRestLengthCBox`) floatSliderGrp -e -enable true constrainSpringRestLength; else floatSliderGrp -e -enable false constrainSpringRestLength; } else { floatSliderGrp -e -enable false constrainSpringStiffness; floatSliderGrp -e -enable false constrainSpringDamping; floatSliderGrp -e -enable false constrainSpringRestLength; checkBoxGrp -e -enable false constrainSpringRestLengthCBox; } } global proc dynConstraintOrientationCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true constrainOrientX; floatSliderGrp -e -enable true constrainOrientY; floatSliderGrp -e -enable true constrainOrientZ; } else { floatSliderGrp -e -enable false constrainOrientX; floatSliderGrp -e -enable false constrainOrientY; floatSliderGrp -e -enable false constrainOrientZ; } } global proc dynConstraintTypeCB() { int $option = `optionMenuGrp -q -sl constrainTypesOM`; switch ($option) { // Nail // case 1: dynConstraintEnableSpring(0); dynConstraintEnableInterpenetrate(0); dynConstraintOrientationCB(0); break; // Pin // case 2: dynConstraintEnableSpring(0); dynConstraintEnableInterpenetrate(1); dynConstraintOrientationCB(0); break; // Hinge // case 3: dynConstraintEnableSpring(0); dynConstraintEnableInterpenetrate(1); dynConstraintOrientationCB(1); break; // Spring // case 4: dynConstraintEnableSpring(1); dynConstraintEnableInterpenetrate(1); dynConstraintOrientationCB(0); break; // Barrier // case 5: dynConstraintEnableSpring(0); dynConstraintEnableInterpenetrate(0); dynConstraintOrientationCB(1); break; default: break; } } global proc dynConstraintPositionCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable true constrainPosX; floatSliderGrp -e -enable true constrainPosY; floatSliderGrp -e -enable true constrainPosZ; } else { floatSliderGrp -e -enable false constrainPosX; floatSliderGrp -e -enable false constrainPosY; floatSliderGrp -e -enable false constrainPosZ; } } global proc dynConstrainSpringRestLengthCB(int $isOn) { if ($isOn) floatSliderGrp -e -enable true constrainSpringRestLength; else floatSliderGrp -e -enable false constrainSpringRestLength; } global proc softGoalCB(int $isOn) // // Description: // set the goal slider control enabled iff the weight option // box is checked. { if ($isOn) floatSliderGrp -e -enable true softWeight; else floatSliderGrp -e -enable false softWeight; // softCBoxCB(); } global proc softCBoxCB() // // Description: // enable/disable the option box choices which are revelant only // for the duplicate creation options. { int $isDup = `optionMenuGrp -q -sl softCreationOption`; if ($isDup != 1) { // One of the duplicate choices is on, so enable // the duplicate options. checkBoxGrp -e -enable true softHide; checkBoxGrp -e -enable true softGoal; checkBoxGrp -e -enable true softHistory; } else { // Convert in place; turn duplicate options off. // checkBoxGrp -e -enable false softHide; checkBoxGrp -e -enable false softGoal; checkBoxGrp -e -enable false softHistory; } } global proc dynSpringOptionChoiceCB(string $parent) { setParent $parent; int $choice = `optionMenuGrp -q -sl springMethodsOM`; if ($choice == 1) { floatSliderGrp -e -enable true springMinDistance; floatSliderGrp -e -enable true springMaxDistance; } else { floatSliderGrp -e -enable false springMinDistance; floatSliderGrp -e -enable false springMaxDistance; } if ($choice == 3) { checkBoxGrp -e -enable false springExclusive; } else { checkBoxGrp -e -enable true springExclusive; } } global proc springAddCB(int $isOn) { // If the user is adding springs to an existing spring object, don't // allow to "edit" the attribute values. // if ($isOn) { checkBoxGrp -e -enable false springUseStiffnessPS; checkBoxGrp -e -enable false springUseDampingPS; checkBoxGrp -e -enable false springUseRestLengthPS; floatSliderGrp -e -enable false springStiffness; floatSliderGrp -e -enable false springDamp; floatSliderGrp -e -enable false springRestLength; floatSliderGrp -e -enable false springStartForceWeight; floatSliderGrp -e -enable false springEndForceWeight; } else { checkBoxGrp -e -enable true springUseStiffnessPS; checkBoxGrp -e -enable true springUseDampingPS; checkBoxGrp -e -enable true springUseRestLengthPS; floatSliderGrp -e -enable true springStartForceWeight; floatSliderGrp -e -enable true springEndForceWeight; if (`checkBoxGrp -q -v1 springUseStiffnessPS`) floatSliderGrp -e -enable false springStiffness; else floatSliderGrp -e -enable true springStiffness; if (`checkBoxGrp -q -v1 springUseDampingPS`) floatSliderGrp -e -enable false springDamp; else floatSliderGrp -e -enable true springDamp; if (`checkBoxGrp -q -v1 springUseRestLengthPS`) floatSliderGrp -e -enable false springRestLength; else floatSliderGrp -e -enable true springRestLength; } } global proc springUseStiffnessPSCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable false springStiffness; } else { floatSliderGrp -e -enable true springStiffness; } } global proc springUseDampingPSCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable false springDamp; } else { floatSliderGrp -e -enable true springDamp; } } global proc springUseRestLengthPSCB(int $isOn) { if ($isOn) { floatSliderGrp -e -enable false springRestLength; } else { floatSliderGrp -e -enable true springRestLength; } } global proc springMaxDistCB() { // If the user sets max distance less than min distance, // reset min distance to be the same as max distance. // float $minDist = `floatSliderGrp -q -v springMinDistance`; float $maxDist = `floatSliderGrp -q -v springMaxDistance`; if ($maxDist < $minDist) { floatSliderGrp -e -v $maxDist springMinDistance; } } global proc springMinDistCB() { // If the user sets min distance greater than max distance, // reset max distance to be the same as min distance. // float $minDist = `floatSliderGrp -q -v springMinDistance`; float $maxDist = `floatSliderGrp -q -v springMaxDistance`; if ($minDist > $maxDist) { floatSliderGrp -e -v $minDist springMaxDistance; } } // =================== UTILITY PROCS =============== // // global proc PIwatchCycleOption() { if ((`optionMenuGrp -q -exists PIautoCycleOM` == 0) || (`optionMenuGrp -q -exists ObjectIndexOM` == 0)) return; string $cycleValue = `optionMenuGrp -q -v PIautoCycleOM`; if( $cycleValue == "None" ) { optionMenuGrp -e -enable 1 ObjectIndexOM; optionMenuGrp -e -enable 0 CycleStartObjectOM; optionMenuGrp -e -enable 0 AgeOM; optionMenuGrp -e -enable 0 PIautoCycleStepUnitsOM; floatSliderGrp -e -enable 0 PIautoCycleStepSize; } else { optionMenuGrp -e -enable 0 ObjectIndexOM; optionMenuGrp -e -enable 1 CycleStartObjectOM; optionMenuGrp -e -enable 1 AgeOM; optionMenuGrp -e -enable 1 PIautoCycleStepUnitsOM; floatSliderGrp -e -enable 1 PIautoCycleStepSize; } } global proc PIcreateDynamicAttrOptionMenus() { string $particleName = `optionMenuGrp -q -v PIparticleObjectOM`; if ( size( $particleName ) > 0 ) { string $vectorList[]; string $doubleList[]; int $displayAll = `checkBoxGrp -q -v1 PIdisplayAllTypes`; if ( $displayAll == 0 ) { $vectorList = listParticleAttrs( $particleName, "vectorArray", 0 ); $doubleList = listParticleAttrs( $particleName, "doubleArray", 0 ); } else { $vectorList = listParticleAttrs( $particleName, "vectorArray", 1 ); $doubleList = listParticleAttrs( $particleName, "doubleArray", 1 ); } separator -style "out" PIparticleInstancerGeneralSeparator; frameLayout -collapse 0 -collapsable 0 -borderVisible 0 -label "General Options" PIparticleInstancerGeneralFrame; columnLayout PIparticleInstancerGeneralFrameColumn; PIcreateDynamicMenuItem( $vectorList, "Position", "worldPosition" ); PIcreateDynamicMenuItem( $vectorList, "Scale", "None" ); PIcreateDynamicMenuItem( $vectorList, "Shear", "None" ); PIcreateDynamicMenuItem( $doubleList, "Visibility", "None" ); PIcreateDynamicMenuItem( $doubleList, "ObjectIndex", "None" ); setParent ..; setParent ..; separator -style "out" PIparticleInstancerRotationSeparator; frameLayout -collapse 0 -collapsable 0 -borderVisible 0 -label "Rotation Options" PIparticleInstancerRotationFrame; columnLayout PIparticleInstancerRotationFrameColumn; PIcreateDynamicMenuItem( $doubleList, "RotationType", "None" ); PIcreateDynamicMenuItem( $vectorList, "Rotation", "None" ); PIcreateDynamicMenuItem( $vectorList, "AimDirection", "None" ); PIcreateDynamicMenuItem( $vectorList, "AimPosition", "None" ); PIcreateDynamicMenuItem( $vectorList, "AimAxis", "None" ); PIcreateDynamicMenuItem( $vectorList, "AimUpAxis", "None" ); PIcreateDynamicMenuItem( $vectorList, "AimWorldUp", "None" ); setParent ..; setParent ..; separator -style "out" PIparticleInstancerCycleSeparator; frameLayout -collapse 0 -collapsable 0 -borderVisible 0 -label "Cycle Options" PIdynParticleInstancerCycleFrame; columnLayout PIdynParticleInstancerCycleFrameColumn; PIcreateDynamicMenuItem( $doubleList, "CycleStartObject", "None" ); PIcreateDynamicMenuItem( $doubleList, "Age", "age" ); setParent ..; setParent ..; } PIwatchCycleOption(); } global proc int PIcreateParticleObjectList() { int $i; string $particleList[] = `ls -typ particle`; int $count = size( $particleList ); if ( $count == 0 ) { menuItem -l "No Particle Shapes Found" PInoParticleShapes; } else { for ( $i = 0; $i < $count; $i++ ) { menuItem -l $particleList[$i] $particleList[$i]; } } return $count; } global proc __INST_OBJ_LIST_fillItemList() { global string $__INST_OBJ_LIST_items[]; int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`; textScrollList -e -visible 0 PIselectObjectList; textScrollList -e -removeAll PIselectObjectList; int $i; if( size($__INST_OBJ_LIST_items) == 0 ) { textScrollList -e -append " " -width 380 PIselectObjectList; } else { for( $i = 0; $i < size($__INST_OBJ_LIST_items); $i ++ ) { string $newText = ($i + ": " + $__INST_OBJ_LIST_items[$i]); textScrollList -e -append $newText -width 380 PIselectObjectList; } } int $firstSelected = $selectedIndices[0]; if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` ) { int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList`; textScrollList -e -showIndexedItem $selectThis PIselectObjectList; } textScrollList -e -visible 1 PIselectObjectList; } global proc __INST_OBJ_LIST_addItemsFromList( string $list[] ) { global string $__INST_OBJ_LIST_items[]; int $i; for( $i = 0; $i < size($list); $i ++ ) { if( isValidInstancedObject( $list[$i] ) == 1 ) { int $found = 0; int $j; for( $j = 0; $j < size($__INST_OBJ_LIST_items); $j ++ ) { if( $list[$i] == $__INST_OBJ_LIST_items[$j] ) { $found = 1; } } if( $found == 0 ) { $__INST_OBJ_LIST_items[size($__INST_OBJ_LIST_items)] = $list[$i]; } } } __INST_OBJ_LIST_fillItemList(); } global proc __INST_OBJ_LIST_addItemsFromSelectionList() { global string $__INST_OBJ_LIST_items[]; string $selectedItems[] = `ls -sl`; __INST_OBJ_LIST_addItemsFromList( $selectedItems ); } global proc createParticleInstancerLayout( string $parent ) { setParent $parent; textFieldGrp -l "Particle Instancer Name" particleInstancerName; optionMenuGrp -l "Rotation Units" PIrotationUnitsOM; menuItem -l "Degrees" PIdegreesRotationUnits; menuItem -l "Radians" PIradiansRotationUnits; optionMenuGrp -l "Rotation Order" PIrotationOrderOM; menuItem -l "XYZ" PIxyzRotationOrder; menuItem -l "XZY" PIxzyRotationOrder; menuItem -l "YXZ" PIyxzRotationOrder; menuItem -l "YZX" PIyzxRotationOrder; menuItem -l "ZXY" PIzxyRotationOrder; menuItem -l "ZYX" PIzyxRotationOrder; optionMenuGrp -l "Level Of Detail" PIlevelOfDetailOM; menuItem -l "Geometry" PIgeometryLevelOfDetail; menuItem -l "BoundingBox" PIboundingBoxLevelOfDetail; menuItem -l "BoundingBoxes" PIboundingBoxesLevelOfDetail; // Cycle Types // optionMenuGrp -l "Cycle" -cc "PIwatchCycleOption()" PIautoCycleOM; menuItem -l "None" PIautoCycleNone; menuItem -l "Sequential" PIautoCycleSequential; // Cycle Step Units option menu. // optionMenuGrp -l "Cycle Step Units" PIautoCycleStepUnitsOM; menuItem -l "Frames" PIautoCycleStepFrames; menuItem -l "Seconds" PIautoCycleStepSeconds; // Cycle Step Size float/slider. // floatSliderGrp -l "Cycle Step Size" -field true -min 0 -max 10 -fmn 0 -fmx 10000 -pre 1 -step 0.5 PIautoCycleStepSize; separator particleInstancerSep1; global string $__INST_OBJ_LIST_items[]; clear($__INST_OBJ_LIST_items); rowColumnLayout -columnWidth 1 400 -numberOfColumns 1 -columnAttach 1 "both" 0 mainLayout; text -label "Instanced Objects" mainListLabel; textScrollList -width 390 -height 94 -allowMultiSelection true -removeAll -annotation "List of the instanced objects and their indices into the instancer." PIselectObjectList; rowColumnLayout -numberOfColumns 4 -columnWidth 1 100 -columnWidth 2 100 -columnWidth 3 100 -columnWidth 4 100 -columnAlign 1 "center" -columnAlign 2 "center" -columnAlign 3 "center" -columnAlign 4 "center" -columnAttach 1 "both" 0 -columnAttach 2 "both" 0 -columnAttach 3 "both" 0 -columnAttach 4 "both" 0 -rowAttach 1 "top" 2 -rowAttach 2 "top" 2 -rowAttach 3 "top" 2 -rowAttach 4 "top" 2 existingItemButtonLayout; button -label "Add Selection" -width 90 -command "__INST_OBJ_LIST_addItemsFromSelectionList()" -annotation "Add selected object(s) to the list." addItemsButton; button -label "Remove Items" -width 90 -command "__INST_OBJ_LIST_removeSelectedItems()" -annotation "Remove the highlighted item(s) from the list." removeItemsButton; button -label "Move Up" -width 90 -command "__INST_OBJ_LIST_moveSelectedItemsUp()" -annotation "Move highlighted item(s) higher in the list." moveItemsUpButton; button -label "Move Down" -width 90 -command "__INST_OBJ_LIST_moveSelectedItemsDown()" -annotation "Move highlighted item(s) lower in the list." moveItemsDownButton; __INST_OBJ_LIST_addItemsFromSelectionList(); setParent ..; setParent ..; separator particleInstancerSep2; checkBoxGrp -l "Allow All Data Types" -ncb 1 -v1 0 -l1 "" -cc ("PIparticleOptionChanged " + $parent) PIdisplayAllTypes; // Particle Object Dynamic Option Menu. // optionMenuGrp -l "Particle Object To Instance" -cc ("PIparticleOptionChanged " + $parent) PIparticleObjectOM; // We only want to create the dynamic attribute list if we have // a valid particle shape. // if ( PIcreateParticleObjectList() > 0 ) { PIcreateDynamicAttrOptionMenus(); } setParent ..; } global proc PIeditDynamicMenuItem( string $list[], string $attrName, int $validHeadSize ) { int $index = 1; string $miName; string $omName = $attrName + "OM"; optionMenuGrp -e -l $attrName $omName; string $omList[] = `optionMenuGrp -q -itemListShort $omName`; int $currentSize = size( $omList ); int $listSize = size( $list ); setParent $omName; string $menuParent = `setParent -q`; string $parent = `setParent -m ($menuParent + "|OptionMenu")`; // Make sure that all attributes have a "None" menu item except // for "Position" which always needs to have a valid value. // int $offset = 0; if ( $attrName != "Position" ) { $listSize += 1; $offset = 1; } if ( $listSize > $currentSize ) { // // Add more entries if needed. // for ( $i = $currentSize; $i < $listSize; $i++ ) { $index = $i + 1; $miName = $attrName + "MenuItem" + $index; menuItem -l $list[$i] $miName; } } else if ( $listSize < $currentSize ) { // // Remove extra entries. // for ( $i = $listSize; $i < $currentSize; $i++ ) { deleteUI $omList[$i]; } } $index = $validHeadSize+$offset+1; int $listIndex = $validHeadSize; for ( $i = $validHeadSize + $offset; $i < $listSize; $i++ ) { $miName = $attrName + "MenuItem" + $index; menuItem -e -l $list[$listIndex] $miName; $index++; $listIndex++; } } global proc PIeditDynamicAttrOptionMenus() { string $particleName = `optionMenuGrp -q -v PIparticleObjectOM`; if ( size( $particleName ) > 0 ) { string $vectorList[]; string $doubleList[]; int $displayAll = `checkBoxGrp -q -v1 PIdisplayAllTypes`; if ( $displayAll == 0 ) { $vectorList = listParticleAttrs( $particleName, "vectorArray", 0 ); $doubleList = listParticleAttrs( $particleName, "doubleArray", 0 ); } else { $vectorList = listParticleAttrs( $particleName, "vectorArray", 1 ); $doubleList = listParticleAttrs( $particleName, "doubleArray", 1 ); } PIeditDynamicMenuItem( $vectorList, "Position", 9 ); PIeditDynamicMenuItem( $vectorList, "Scale", 9 ); PIeditDynamicMenuItem( $vectorList, "Shear", 9 ); PIeditDynamicMenuItem( $doubleList, "Visibility", 4 ); PIeditDynamicMenuItem( $doubleList, "ObjectIndex", 4 ); PIeditDynamicMenuItem( $doubleList, "RotationType", 4 ); PIeditDynamicMenuItem( $vectorList, "Rotation", 9 ); PIeditDynamicMenuItem( $vectorList, "AimDirection", 9 ); PIeditDynamicMenuItem( $vectorList, "AimPosition", 9 ); PIeditDynamicMenuItem( $vectorList, "AimAxis", 9 ); PIeditDynamicMenuItem( $vectorList, "AimUpAxis", 9 ); PIeditDynamicMenuItem( $vectorList, "AimWorldUp", 9 ); PIeditDynamicMenuItem( $doubleList, "CycleStartObject", 4 ); PIeditDynamicMenuItem( $doubleList, "Age", 4 ); } } global proc PIupdateDynamicAttributeOptionVar( string $name ) { string $omName = $name + "OM"; if ( `optionMenuGrp -q -exists $omName` == 1 ) { optionVar -stringValue $omName `optionMenuGrp -q -v $omName`; } } global proc PIcreateSelectedObjectList() { int $i; string $transformList[] = `ls -typ transform`; for ( $i = 0; $i < size( $transformList ); $i++ ) { textScrollList -e -a $transformList[$i] PIselectObjectList; } } global proc PIparticleOptionChanged( string $parent ) { setParent $parent; string $particleList[] = `ls -typ particle`; // We only want to create the dynamic attribute list if we have // a valid particle shape. // if ( size( $particleList ) > 0 ) { PIeditDynamicAttrOptionMenus(); } // Update the values of the selected menu item. We need to do this // because the indices may have changed if the number of attributes // is not the same for each particle shape. // setAllDynamicAttributeOptionMenuGrp(); } global proc __INST_OBJ_LIST_setItemList( string $list[] ) { global string $__INST_OBJ_LIST_items[]; $__INST_OBJ_LIST_items = $list; __INST_OBJ_LIST_fillItemList(); } global proc __INST_OBJ_LIST_removeSelectedItems() { global string $__INST_OBJ_LIST_items[]; int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`; if( size($selectedIndices) == 0 ) return; int $i; int $j; string $temp[]; for( $i = 0; $i < size($__INST_OBJ_LIST_items); $i ++ ) { int $found = 0; for( $j = 0; $j < size($selectedIndices); $j ++ ) { if( $selectedIndices[$j] == $i+1 ) $found = 1; } if( $found == 0 ) { $temp[size($temp)] = $__INST_OBJ_LIST_items[$i]; } } $__INST_OBJ_LIST_items = $temp; __INST_OBJ_LIST_fillItemList(); } global proc __INST_OBJ_LIST_moveSelectedItemsUp() { global string $__INST_OBJ_LIST_items[]; int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`; if( size($selectedIndices) == 0 ) return; int $newSelectedIndices[] = $selectedIndices; int $i; for( $i = 0; $i < size($selectedIndices); $i ++ ) { int $si = $selectedIndices[$i] - 1; if( $si > $i ) { string $temp = $__INST_OBJ_LIST_items[$si]; $__INST_OBJ_LIST_items[$si] = $__INST_OBJ_LIST_items[$si-1]; $__INST_OBJ_LIST_items[$si-1] = $temp; $newSelectedIndices[$i] = $si; } } __INST_OBJ_LIST_fillItemList(); for( $i = 0; $i < size($newSelectedIndices); $i ++ ) { textScrollList -e -selectIndexedItem $newSelectedIndices[$i] PIselectObjectList; } int $firstSelected = $newSelectedIndices[0]; if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` ) { int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList` + 1; textScrollList -e -showIndexedItem $selectThis PIselectObjectList; } } global proc __INST_OBJ_LIST_moveSelectedItemsDown() { global string $__INST_OBJ_LIST_items[]; int $selectedIndices[] = `textScrollList -q -selectIndexedItem PIselectObjectList`; if( size($selectedIndices) == 0 ) return; int $newSelectedIndices[] = $selectedIndices; int $i; for( $i = size($selectedIndices) - 1; $i >= 0 ; $i -- ) { int $si = $selectedIndices[$i] - 1; int $ni = size($__INST_OBJ_LIST_items) - ( size($selectedIndices) - $i ); if( $si < $ni ) { string $temp = $__INST_OBJ_LIST_items[$si]; $__INST_OBJ_LIST_items[$si] = $__INST_OBJ_LIST_items[$si+1]; $__INST_OBJ_LIST_items[$si+1] = $temp; $newSelectedIndices[$i] = $si+2; } } __INST_OBJ_LIST_fillItemList(); for( $i = 0; $i < size($newSelectedIndices); $i ++ ) { textScrollList -e -selectIndexedItem $newSelectedIndices[$i] PIselectObjectList; } int $firstSelected = $newSelectedIndices[size($newSelectedIndices)-1]; if( $firstSelected > `textScrollList -q -numberOfRows PIselectObjectList` ) { int $selectThis = $firstSelected - `textScrollList -q -numberOfRows PIselectObjectList` + 1; textScrollList -e -showIndexedItem $selectThis PIselectObjectList; } }